#查找likes为222的数据并打印 
data <- read.csv("sites.csv", encoding="UTF-8")

# likes 为 222 的数据
retval <- subset(data, likes == 222)
# print(retval)

# 多个条件用& 为分隔符

data <- read.csv("sites.csv", encoding="UTF-8")

# likes 大于 1 name 为 Runoob 的数据
retval <- subset(data, likes > 1 & name=="Runoob")
# print(retval)

#保存为 CSV 文件  write.csv() 
data <- read.csv("sites.csv", encoding="UTF-8")

# likes 为 222 的数据
retval <- subset(data, likes == 222)

# 写入新的文件
write.csv(retval,"runoob.csv")
newdata <- read.csv("runoob.csv")
print(newdata)


#  X id   name            url likes
# 1 2  2 Runoob www.runoob.com   222

